package sparrowGui.skin
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	import sparrowGui.utils.PubFun;

	public class RadioItemSkin extends TagsBtnSkin
	{
		public function RadioItemSkin()
		{
			super();
		}
		
		override protected function init():void
		{
			var txt:TextField = new TextField();
			upState = new Sprite();
			drawShap(upState,2);
			drawShap(upState,4,5,0,0xD5D8DC);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			upState.addChild(txt);
			upState.name = "upState";
			
			selectState = new Sprite();
			txt = new TextField();
			drawShap(selectState,2,7,0x666666);
			drawShap(selectState,5,4,0,0x184157);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			selectState.addChild(txt);
			txt.textColor = 0x333333;
			selectState.name = "selectState";
			
			overState = new Sprite();
			txt = new TextField();
			drawShap(overState,2,7,0x59859F,0xDBF6F8);
			drawShap(overState,4,5,0,0xB7E9FE);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			overState.addChild(txt);
			overState.name = "overState";
			
			downState = new Sprite();
			txt = new TextField();
			drawShap(downState,2,7,0x59859F,0xDBF6F8);
			drawShap(downState,4,5,0,0xB7E9FE);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			downState.addChild(txt);
			downState.name = "downState";
			
//			hitTestState = new Sprite();
//			hitTestState.graphics.beginFill(0xFF0000);
//			hitTestState.graphics.drawRect(0,0,this.width,this.height);
//			hitTestState.graphics.endFill();
			hitTestState = null;
		}
		
		// 画圆
		protected function drawShap(sp:Sprite,txy:int,r:int=7,borderColor:int=0x666666,bgColor:int=0xFFFFFF):void
		{
			sp.graphics.beginFill(bgColor);
			if(borderColor) sp.graphics.lineStyle(1,borderColor);
			else sp.graphics.lineStyle(0,0,0);
			sp.graphics.drawCircle((txy+r),(txy+r),r);
			sp.graphics.endFill();
		}
	}
}